var mySwiper = new Swiper('.swiper-container', {
    autoplay:{
        stopOnLastSilde:false
    },
    pagination : '.swiper-pagination'
});

conversion = function (id, productName, productPrice) {
    var reservationsId = $('#reservationsId').val();
    if (reservationsId == "" || reservationsId == null || reservationsId == undefined
        || reservationsId == "null" || reservationsId == "undefined") {
        Feng.success("请先登录!");
        window.location.href = Feng.ctxPath + "/integralMallWeixin/logincus";
        return false;
    }
    if (confirm("是否确定花费" + productPrice + "积分，兑换:" + productName + "？")) {
        $.ajax({
            url: Feng.ctxPath + "/integralMallWeixin/conversion",
            type: "post",
            data: {
                "id": id,
                "reservationsId": reservationsId
            },
            success: function (data) {
                if (data == 9) {
                    Feng.success("请先登录!");
                    window.location.href = Feng.ctxPath + "/integralMallWeixin/logincus";
                } else {
                    if (data == 1) {
                        alert('该商品已经售完，请选择其他商品!');
                    } else if (data == 2) {
                        alert('余额不够兑换，请选择其他商品!');
                    } else {
                            Feng.success('操作成功!');
                            window.parent.parent.location.href = Feng.ctxPath + '/integralMallWeixin/integralRecord/' + "2";
                            parent.layer.close(parent.layer.getFrameIndex(window.name));
                    }
                }
            },
            error: function (data) {
                alert('权限被限制，请联系管理员!');
            }
        });
    }
};